Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoware_utils): porting from autoware_universe_utils #23

Merged
merged 20 commits into from
Jan 23, 2025

Conversation

JianKangEgon
Copy link
Contributor

@JianKangEgon JianKangEgon commented Jan 16, 2025

Description

We are porting package autoware_universe_utils to autoware.core, and this PR adds the package to core.

How was this PR tested?

Notes for reviewers

None.

Effects on system behavior

None.

  • update readme
  • chang function naming pattern
  • create pr

Copy link

github-actions bot commented Jan 16, 2025

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

… same namespace will cause compile error when triggering template specilization

Signed-off-by: NorahXiong <[email protected]>
Copy link
Member

@youtalk youtalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR title and description are not correct. Please update them properly first.

@mitsudome-r
Copy link
Member

Hi, it's a bit hard to review since the PR is quite big. Is it possible to break it into pieces? Maybe breaking it into the following the include directory structure might be good:

  • geometry
  • math
  • ros
  • system
  • transform

@mitsudome-r
Copy link
Member

Sorry, please ignore my comment above. I think we will be able to review it with the current size.

Copy link
Contributor

@esteve esteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the coding conventions we have, code must live under a namespace like:

autoware::PACKAGE_NAME

@JianKangEgon I've added a bunch of suggestions that you can just accept.

#include <utility>
#include <vector>

namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace for all the header files needs to be autoware::utils

Suggested change
namespace autoware_utils
namespace autoware::utils


#include <geometry_msgs/msg/point.hpp>

namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace autoware_utils
namespace autoware::utils

point.z() = msg.z;
return point;
}
} // namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} // namespace autoware_utils
} // namespace autoware::utils


#include <vector>

namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace autoware_utils
namespace autoware::utils

const double base_to_rear, const double width);
double get_area(const autoware_perception_msgs::msg::Shape & shape);
Polygon2d expand_polygon(const Polygon2d & input_polygon, const double offset);
} // namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} // namespace autoware_utils
} // namespace autoware::utils

const std::function<
bool(const autoware_utils::Polygon2d &, const autoware_utils::Polygon2d &)> &);

} // namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} // namespace autoware_utils
} // namespace autoware::utils


#include <autoware_utils/geometry/geometry.hpp>

namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace autoware_utils
namespace autoware::utils

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing, esteve san

we have change the name space according to your comment

Have a nice day!

/// @param max points will be generated in the range [-max,max]
/// @details algorithm from https://cglab.ca/~sander/misc/ConvexGeneration/convex.html
Polygon2d random_convex_polygon(const size_t vertices, const double max);
} // namespace autoware_utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} // namespace autoware_utils
} // namespace autoware::utils


#include "autoware_utils/geometry/boost_geometry.hpp"

namespace autoware_utils::sat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace autoware_utils::sat
namespace autoware::utils::sat

*/
bool intersects(const Polygon2d & convex_polygon1, const Polygon2d & convex_polygon2);

} // namespace autoware_utils::sat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} // namespace autoware_utils::sat
} // namespace autoware::utils::sat

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including too many files has led to poor maintainability, and including autoware_utils.hpp results in significant dependencies.
Therefore, for example, how about creating autoware_utils/geometry.hpp, which consolidates the includes under autoware_utils/geometry, and including it in autoware_utils.hpp? This way, files that only need geometry will not be affected by other dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a porting PR, so this fix can be included in a separate PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with you kondo san, @youtalk

Let‘s porting first then divide it in core repo in another pr

have a nice day

心刚

@mitsudome-r
Copy link
Member

mitsudome-r commented Jan 22, 2025

@esteve @JianKangEgon

According to the coding conventions we have, code must live under a namespace like:
autoware::PACKAGE_NAME

I think this is a good point. However, this modification requires changes to different repositories that depend on this package as well (e.g., in autoware_lanelet2_extension, autoware.universe, etc.).

I suggest we can focus first on moving the function from autoware_universe_utils to autoware_utils in this PR, then do namespace refactoring in another PR. We probably have to change the directory structure as well.

…updated in further version

Signed-off-by: JianKangEgon <[email protected]>
@liuXinGangChina
Copy link

@esteve @JianKangEgon

According to the coding conventions we have, code must live under a namespace like:
autoware::PACKAGE_NAME

I think this is a good point. However, this modification requires changes to different repositories that depend on this package as well (e.g., in autoware_lanelet2_extension, autoware.universe, etc.).

I suggest we can focus first on moving the function from autoware_universe_utils to autoware_utils in this PR, then do namespace refactoring in another PR. We probably have to change the directory structure as well.

Good afternoon, mits san @mitsudome-r

autoware_utils pr already revert, please help us review and merge it

Best regards
心刚

@liuXinGangChina
Copy link

liuXinGangChina commented Jan 22, 2025

I think the PR title and description are not correct. Please update them properly first.

Good afternoon Kondo San @youtalk

Thanks for reviewing this pr, can you indicate the issue in the title and description of the pr. I will inform the engineer to modify according to your comment

Best Regards

心刚

@esteve
Copy link
Contributor

esteve commented Jan 22, 2025

@esteve @JianKangEgon
I suggest we can focus first on moving the function from autoware_universe_utils to autoware_utils in this PR, then do namespace refactoring in another PR. We probably have to change the directory structure as well.

The respective packages in autoware.universe already have the autoware::PACKAGE_NAME convention (e.g. https://github.com/autowarefoundation/autoware.universe/blob/main/common/autoware_vehicle_info_utils/include/autoware_vehicle_info_utils/vehicle_info.hpp#L20). This PR is undoing that work, so we'll end up doing this three times: once when we made the change in autoware.universe, then undoing it here, and then another PR in the future to do it again.

I propose we just move the code and keep the convention that's already implemented in autoware_vehicle_info_utils, autoware_time_utils, etc. (for example https://github.com/autowarefoundation/autoware.universe/blob/main/common/autoware_time_utils/include/autoware/time_utils/time_utils.hpp)

@liuXinGangChina
Copy link

liuXinGangChina commented Jan 23, 2025

@esteve @JianKangEgon
I suggest we can focus first on moving the function from autoware_universe_utils to autoware_utils in this PR, then do namespace refactoring in another PR. We probably have to change the directory structure as well.

The respective packages in autoware.universe already have the autoware::PACKAGE_NAME convention (e.g. https://github.com/autowarefoundation/autoware.universe/blob/main/common/autoware_vehicle_info_utils/include/autoware_vehicle_info_utils/vehicle_info.hpp#L20). This PR is undoing that work, so we'll end up doing this three times: once when we made the change in autoware.universe, then undoing it here, and then another PR in the future to do it again.

I propose we just move the code and keep the convention that's already implemented in autoware_vehicle_info_utils, autoware_time_utils, etc. (for example https://github.com/autowarefoundation/autoware.universe/blob/main/common/autoware_time_utils/include/autoware/time_utils/time_utils.hpp)

I get your point , esteve san. @esteve

I have a meeting with mits san yesterday, and his idea is we merge this pr first keep "autoware_util::xxx" name space pattern and followed by a pr to change namespace to "autoware::xxx" along with the modifications of package under core repo which use autoware_utils

is this solution ok to you?

Best regards

心刚

@youtalk youtalk changed the title feat(autoware_utils): porting from universe to core feat(autoware_utils): porting from autoware_universe_utils Jan 23, 2025
Copy link
Member

@youtalk youtalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not autoware.core or autoware.universe, but the autoware_utils repository, so even if the namespace rules are different, it can still be somewhat understood.

I've changed the PR's title.

@youtalk
Copy link
Member

youtalk commented Jan 23, 2025

@mitsudome-r Many PRs depend on this and can’t be merged, so although the issue with @esteve’s namespace remains, shall we proceed with a bypass merge?

@mitsudome-r
Copy link
Member

@esteve @youtalk

I think we also have an issue that this package is already released as 1.0.0 in ROS Buildfarm. We might want to be careful with changing the API in the same distribution. We probably should do the namespace when we prepare the release for 2.0.0.

Since this is being a blocker for many other PRs, let's merge it and do the namespace renaming in another occasion.

Copy link
Member

@mitsudome-r mitsudome-r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks okay with me.

@esteve
Copy link
Contributor

esteve commented Jan 23, 2025

This is not autoware.core or autoware.universe, but the autoware_utils repository

I was under the impression that the code conventions apply to all the projects in the autowarefoundation organization. @xmfcx @mitsudome-r Could you please clarify?

@esteve
Copy link
Contributor

esteve commented Jan 23, 2025

@JianKangEgon @mitsudome-r @youtalk @xmfcx my mistake, sorry, I thought that the autoware_utils repository was empty and that's why I suggested to copy the code as is from autoware.universe, but I see that there's already code in autoware_utils under the autoware_utils namespace, and I agree it's better to keep new code under the existing autoware_utils namespace and the same filesystem structure to avoid any confusion.

After all the PRs have been merged we can discuss whether we should follow the autoware.core and autoware.universe code conventions or keep it as is, but for now I'm fine with using the autoware_utils namespace.

Copy link
Contributor

@esteve esteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JianKangEgon LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants